package com.zhuimeng.Application.entity;

import javax.websocket.Session;
import java.util.ArrayList;
import java.util.List;

public class Room {

    private int roomId;
    private Player player1;
    private Player player2;
    private int isSubscrribe;
    private int status;
    private String info;
    private String pass;
    private int PlayerRegret = -2;
    private int PlayerReopen = -2;

    private GoBank goBank = new GoBank();
    private List<Player> subscrribe=new ArrayList<>();


    public void put2Subscrribe(Player player){
        subscrribe.add(player);
    }


    public Player getOtherPlayer(Session session) {
        if (player1 != null && player1.getSession() == session) {
            return player2;
        } else {
            return player1;
        }
    }

    public Player getPlayer(Session session) {
        if (player1 != null && player1.getSession() == session) {
            return player1;
        } else {
            return player2;
        }
    }

    public int getPlayerRegret() {
        return PlayerRegret;
    }

    public void setPlayerRegret(int playerRegret) {
        PlayerRegret = playerRegret;
    }

    public int getPlayerReopen() {
        return PlayerReopen;
    }

    public void setPlayerReopen(int playerReopen) {
        PlayerReopen = playerReopen;
    }

    public int getRoomId() {
        return roomId;
    }

    public void setRoomId(int roomId) {
        this.roomId = roomId;
    }

    public Player getPlayer1() {
        return player1;
    }

    public void setPlayer1(Player player1) {
        this.player1 = player1;
    }

    public Player getPlayer2() {
        return player2;
    }

    public void setPlayer2(Player player2) {
        this.player2 = player2;
    }

    public List<Player> getSubscrribe() {
        return subscrribe;
    }

    public void setSubscrribe(List<Player> subscrribe) {
        this.subscrribe = subscrribe;
    }

    public int getIsSubscrribe() {
        return isSubscrribe;
    }

    public void setIsSubscrribe(int isSubscrribe) {
        this.isSubscrribe = isSubscrribe;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public GoBank getGoBank() {
        return goBank;
    }

    public void setGoBank(GoBank goBank) {
        this.goBank = goBank;
    }

    @Override
    public String toString() {
        return "Room{" +
                "roomId=" + roomId +
                ", player1=" + player1 +
                ", player2=" + player2 +
                ", subscrribe=" + subscrribe +
                ", isSubscrribe=" + isSubscrribe +
                ", status=" + status +
                ", info='" + info + '\'' +
                ", pass='" + pass + '\'' +
                '}';
    }
}
